Skip to content

feat(recovery): EchoPartialSection + EchoFibreIntersection; wire EchoTruncation (squeakwell R3/R8/R9/R12/R13) - #370

Open
hyperpolymath wants to merge 3 commits into
mainfrom
claude/gracious-darwin-vkgj6l
Open

hyperpolymath wants to merge 3 commits into
mainfrom
claude/gracious-darwin-vkgj6l

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

The Agda source of truth for the repaired recovery invariants of hyperpolymath/squeakwell (database recovery through cross-modal constraint propagation on VeriSimDB; route plan rungs R3, R8, R9, R12, R13). Rocq recheck: verisimdb formal/Recovery.v (verisimdb#350). Lean side: tropical-types Resource/HubCeiling.lean (tropical-types#67). This also lands the "join-semilattice of partial sections" abstraction that verisimdb's CROSS-REPO-MAP.adoc flagged as the missing echo-types companion to Octad.v R1–R3.

What lands

  • EchoPartialSection.agda (Tier 1: Echo + stdlib). Partial sections (m : M) → Maybe (V m) of a modality bundle — the octad is an instance. Information order (⊑-refl, ⊑-trans). Resolve-parametric merge with the pointwise R1–R3 twins of Octad.v (merge-comm / merge-assoc / merge-idem: implications from resolve, not CRDT laws). Guarded fill as the left-biased merge against an oracle proposal: fill-guarded, fill-inflationary, and the counter-model FillNotMonotone.fill-not-monotone (two modalities). Restriction to an observed mask and its Echo fibre: restrict-echo, restrict-fibre-agree (a candidate in Echo (restrict T) obs reproduces obs on every observed modality — the fragment-granularity observation-fidelity shape), restrict-blind. Every law is pointwise; no funext.
  • EchoFibreIntersection.agda (Tier 2: Echo + EchoFiberCount). fibre-intersection-iso : Echo < f , g > (y , z) ↔ Narrow f g y z (K-free, refl round-trips). Forgetting or adding a constraint keeps the witness (forget-*-witness, narrow-fin-step-to/from + witness lemmas; the Fin n step is deliberately not a _↔_, since the function-side round trip would need funext). narrow-shrinks: on a finite domain with decidable equality, FiberSize-fin < f , g > (y , z) ≤ FiberSize-fin f y (via dec-×, lock-step with the count's recursion).
  • EchoTruncation.agda wired. Until now compiled only through its corollaries; now in All.agda and pinned (isProp, echo-witnesses-distinct, preimages⇒distinct-echoes, echo-not-prop). With FiberSize-fin≡0⇒no-echo / no-echo⇒FiberSize-fin≡0 it is the review-queue completeness kernel (R13 theory half).

Not claimed: inhabitation of the narrowed fibre; "covering masks ⇒ subsingleton" (needs extensionality over opaque identifiers — dropped in the route plan); termination of the recovery round (Rocq-only, needs the finite octad: iter_9_fixpoint in Recovery.v).

Docs

echo-kernel-note.adoc classification row ("Derived — recovery ladder (2026-11-09)"); MAP.adoc Direction "Database recovery — squeakwell / VeriSimDB bridge [REAL]"; cross-repo-bridge-status.adoc Tracks row + revision entry; CHANGELOG.adoc Added entry.

Verification (this environment, CI-pinned toolchain via scripts/setup-agda.sh)

Agda 2.7.0.1 (checksum-pinned), agda-stdlib 8326c7475af1fa456ca04a0203c168d5d7ff842b, absolute-zero f486c29903434589117fa0662c6f29b0f17d1d5f:

agda --no-libraries -i $AGDA_STDLIB -i $ABSOLUTE_ZERO_AGDA --safe --without-K --cubical-compatible -i proofs/agda proofs/agda/All.agda    # exit 0
agda --no-libraries -i $AGDA_STDLIB -i $ABSOLUTE_ZERO_AGDA --safe --without-K --cubical-compatible -i proofs/agda proofs/agda/Smoke.agda  # exit 0
sh scripts/kernel-guard.sh                                                                                                               # PASS

Warnings are UnsupportedIndexedMatch only (the class the existing suite already emits). Zero postulates, no escape pragmas.


Generated by Claude Code

…Truncation (squeakwell R3/R8/R9/R12/R13)

The Agda source of truth for the repaired recovery invariants of
hyperpolymath/squeakwell (database recovery through cross-modal
constraint propagation on VeriSimDB), rechecked in Rocq as verisimdb
formal/Recovery.v (verisimdb#350) with the Lean side in tropical-types
Resource/HubCeiling.lean (tropical-types#67).

- EchoPartialSection.agda (Tier 1: Echo + stdlib). Partial sections
  (m : M) → Maybe (V m) of a modality bundle — the octad as an instance;
  the information order (refl, trans); the resolve-parametric merge
  with the pointwise R1–R3 twins of Octad.v (merge-comm / merge-assoc /
  merge-idem, implications from resolve, not CRDT laws); guarded fill
  as the left-biased merge against an oracle proposal — never
  overwrites (fill-guarded), inflationary (fill-inflationary), and NOT
  monotone (FillNotMonotone.fill-not-monotone, two-modality
  counter-model); restriction to an observed mask and its Echo fibre
  (restrict-echo, restrict-fibre-agree, restrict-blind — the
  fragment-granularity observation-fidelity shape). Funext-free: every
  law is pointwise.
- EchoFibreIntersection.agda (Tier 2: Echo + EchoFiberCount). Binary
  narrowing is the fibre of the pairing (fibre-intersection-iso, a
  K-free _↔_ with refl round-trips); forgetting or adding a constraint
  keeps the witness (forget-*-witness, narrow-fin-step-to/from and
  their witness lemmas); on a finite domain the honest count never
  grows when an observation is added (narrow-shrinks, via dec-× and
  lock-step recursion with FiberSize-fin). Not claimed: inhabitation,
  or "covering masks ⇒ subsingleton" (needs extensionality).
- EchoTruncation.agda, until now compiled only through its example
  corollaries, is wired into All.agda and pinned (isProp,
  echo-witnesses-distinct, preimages⇒distinct-echoes, echo-not-prop) —
  with the FiberSize-fin ≡ 0 ⇔ ¬Echo pair it is the review-queue
  completeness kernel.

Docs: echo-kernel-note classification row, MAP Direction "Database
recovery — squeakwell / VeriSimDB bridge", bridge-status Tracks row and
revision entry, CHANGELOG Added entry.

Verified here with the CI-pinned toolchain (Agda 2.7.0.1, agda-stdlib
8326c74, absolute-zero f486c29): both new modules, All.agda and
Smoke.agda exit 0 under --safe --without-K --cubical-compatible
(warnings: UnsupportedIndexedMatch only, as the existing suite emits);
zero postulates; scripts/kernel-guard.sh PASS.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDizuhJtQDcxHxM2wj8
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Summary

Summary by CodeRabbit

  • New Features
    • Added formal results for partial sections, information ordering, guarded filling, observed-mask restriction and their associated witness fibres.
    • Added binary and finite-family narrowing results, including witness-preserving steps and a bound on how much paired constraints can reduce a fibre.
  • Documentation
    • Updated proof maps and cross-project status records with the recovery-ladder results, verification checks and limitations.
    • Added the new proof modules to the project’s imports and smoke checks.

The change adds Agda proofs for partial sections and fibre intersections. It imports and pins the recovery modules, including EchoTruncation, and updates documentation with the results, cross-repository status and stated limits.

Changes: Recovery proofs

Layer / File(s) Summary
Partial-section operations and properties
proofs/agda/EchoPartialSection.agda, docs/echo-types/MAP.adoc
Defines an information order, resolver-parametric merge, guarded fill and observed-mask restriction. The proofs show that fill is inflationary but not generally monotone, and establish the stated restriction-fibre properties.
Fibre intersection and narrowing
proofs/agda/EchoFibreIntersection.agda, docs/echo-types/MAP.adoc
Defines binary and finite-family narrowing. The proofs establish the paired-fibre correspondence, witness-preserving conversions and the finite-fibre count bound.
Module integration and recovery records
proofs/agda/All.agda, proofs/agda/Smoke.agda, proofs/agda/EchoTruncation.agda, CHANGELOG.adoc, docs/bridges/cross-repo-bridge-status.adoc, docs/echo-types/MAP.adoc, docs/echo-types/echo-kernel-note.adoc
Imports the recovery modules into All.agda and pins selected names in Smoke.agda. The documentation records the stated proof results, checks, related implementations and limits.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Possibly related PRs

Merge Risk: Minimal · up to 3d02d

This change adds proofs and documentation, and no runtime behavior changes. The status wording could be tightened, but it does not block merging.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the two new Agda modules and the EchoTruncation wiring, which are the main changes. It is long, but it is specific and relevant.
Description check Passed The description explains the Agda modules, their proof results, the truncation wiring, and the reported verification. It is related to the changeset.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (8 skipped: 8 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-09T15:49:52.004933Z
We couldn’t complete this review. Comment @codex review to try again.
ec18ac5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@hyperpolymath
hyperpolymath enabled auto-merge (squash) November 9, 2026 23:19
hyperpolymath added a commit to hyperpolymath/squeakwell that referenced this pull request Nov 10, 2026
…onest wording; PROOF-STATUS ledger (#80)

## Summary

This PR has four commits.

1. Fixes the Codex review findings that arrived on
[#78](#78)
after it merged. Two were P1: rollback destroyed every batch, and the
Containerfile built nothing. The rest were P2 wording and placeholder
items.
2. Adds the proof ledger `PROOF-STATUS.adoc`, which
README-EXPLAINME-STANDARD section 5 requires before any proof is
claimed. The first rungs of the proof ladder now have prover-checked
artefacts in other repositories.
3. Two rounds of CodeRabbit review fixes. The main ones: batch volumes
each get their own VeriSimDB session, the VeriSimDB URL no longer
appears in logs, and an empty URL now behaves like an unset one. The
ledger's axiom attributions were corrected after a per-lemma re-check.

## Changes

- **P1 rollback (`container/deploy.k9.ncl`)**: each recovery batch runs
on its own named volume `squeakwell-data-<BATCH_ID>`. The default ID is
the UTC time plus the shell's PID, so two batches started in the same
second still differ. Rollback requires `BATCH_ID`, inspects that one
volume and removes only it. The one-line recipes stop with an error if
`BATCH_ID` or `VERISIMDB_URL` is unset.
- **P1 build (`container/Containerfile`, `container/entrypoint.sh`)**: a
wolfi builder stage runs `cargo build --release --locked`, and the
runtime stage copies only the binary. squeakwell is a batch job, so
`EXPOSE`, `HEALTHCHECK` and `APP_PORT` are removed. The entrypoint runs
`/app/squeakwell "$@"`.
- **Per-batch VeriSimDB session (`src/engine/mod.rs`)**: the session ID
is derived from `SQUEAKWELL_BATCH_ID` when it is set. Without this,
every batch mounts its volume at `/data` and they would all share one
session ID. `compose.toml` and the k9 component pass `BATCH_ID` through.
Without a batch ID the session ID still comes from the workdir path, as
before.
- **VeriSimDB URL handling**: the entrypoint logs only the scheme and
host of `VERISIMDB_URL`, with userinfo, path and query stripped. It also
says whether the variable is unset or set to an empty string. The client
treats an empty or blank URL as unset.
- **P2 placeholders**: every `{{TOKEN}}` in `container/` is now filled
in:
  - `manifest.toml`: no listening sockets.
  - `vordr.toml`: no HTTP probe.
  - `compose.toml`: one batch service and one volume per batch.
- `ct-build.sh`, `.gatekeeper.yaml`, `container/README.adoc` and its AI
manifest.
- **Wording**: README, EXPLAINME, `STATE.a2ml`, PROOF-NEEDS and
TEST-NEEDS are corrected:
  - The gate ceiling is L6, and Phase 5 adds no level.
  - VCL-UT gating is planned. The current stub does not invoke the gate.
  - No proof lives in this repo, and the Rust engine is unproved.
- The hub-ceiling results are theory only; how they apply to f64
confidence is open.
  - The Zig FFI template is deleted.
- **`PROOF-STATUS.adoc` (new)**: one row per rung R0–R18, using the
estate status vocabulary and naming the backing artefact. A row is
PROVEN or PROVEN-WITH-AXIOMS only where a prover ran:
- **Rocq:**
[verisimdb#350](hyperpolymath/verisimdb#350).
Each `Print Assumptions` result is recorded per lemma.
- **Agda:**
[echo-types#370](hyperpolymath/echo-types#370).
- **Lean:**
[tropical-types#67](hyperpolymath/tropical-types#67).

R0, R1, R11, R15 and R16 and the Creusot halves are OPEN, and R17 is
ASSUMED. Each row has a receipt giving the toolchain, command and
result.

## Testing

```
cargo test                 # 29 passed, 0 failed
cargo clippy --all-targets # clean
shellcheck -s sh container/entrypoint.sh   # clean
```

Further checks:
- **Container config:** new tests in `tests/container_config_test.rs`
parse compose, manifest and vordr. They pin the batch service shape,
`VERISIMDB_URL`, `SQUEAKWELL_BATCH_ID`, the per-batch volume and its
declaration.
- **k9 one-line recipes:** run with `BATCH_ID` unset they exit 2; with
it set they expand correctly.
- **Entrypoint redaction:** `https://user:s3cret@host:8443/v1?token=abc`
is logged as `https://host:8443`.

Not run here: the image build itself (`podman build`), because podman is
not available in this environment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01J4QvDizuhJtQDcxHxM2wj8

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
@hyperpolymath
hyperpolymath enabled auto-merge (squash) November 10, 2026 02:59

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments: 1

docs/bridges/cross-repo-bridge-status.adoc-239-239: 1

239-239: Minor · Functional Correctness · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Remove the join-semilattice claim.

Under EchoPartialSection._⊑_, two sections with different present values at one modality have no common upper bound. merge-comm, merge-assoc and merge-idem prove pointwise algebraic laws only when the resolver has those laws. They do not make merge a join under _⊑_. Describe the resolver-parametric merge laws without calling this abstraction a join-semilattice. (raw.githubusercontent.com)

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 1399d425-2cf9-4166-8ec9-5dd42eee11b6
Commits

Reviewing files that changed from the base of the PR and between 9b70faa and 3d02de0.

Files selected for processing: 8

  • CHANGELOG.adoc
  • docs/bridges/cross-repo-bridge-status.adoc
  • docs/echo-types/MAP.adoc
  • docs/echo-types/echo-kernel-note.adoc
  • proofs/agda/All.agda
  • proofs/agda/EchoFibreIntersection.agda
  • proofs/agda/EchoPartialSection.agda
  • proofs/agda/Smoke.agda

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Review details

Context from checks skipped due to timeout: 2

  • GitHub Check: CodeRabbit
  • GitHub Check: cold-check
Additional context used

Learnings: 2

Common learnings

Learnt from: CR
Repo: hyperpolymath/echo-types PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-10-31T20:51:46.566Z
Learning: Source excerpt:
# Working rules in this repo

- Every new module goes into `All.agda` as an `open import` so the
  verified suite covers it. Orphan modules that compile but are not
  in `All.agda` are treated as dead code.
Learnt from: CR
Repo: hyperpolymath/echo-types PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-10-20T14:32:49.454Z
Learning: Source excerpt:
# Working rules in this repo

- No postulates unless explicitly isolated and justified.
Learnt from: CR
Repo: hyperpolymath/echo-types PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-10-31T20:51:46.566Z
Learning: Source excerpt:
# Working rules in this repo

- `--safe --without-K` throughout.
Learning: 2026-11-04T17:52:29.962Z

Learnt from: CR
Repo: hyperpolymath/echo-types PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-11-04T17:52:29.962Z
Learning: Source excerpt:
# Proof policy

The normative estate policy is
https://github.com/hyperpolymath/standards/blob/main/3-practice/PROOF-POLICY.adoc.
Its default Agda theory profile is `--safe --without-K --cubical-compatible`;
full Cubical proofs require a separate reviewed profile. Record toolchain,
assumptions, results and exact source revisions; historical checks do not
prove the new profile. Mathesis grades are theorem- and receipt-specific.

Applied to files:

  • proofs/agda/EchoFibreIntersection.agda
Additional comments: 8

proofs/agda/EchoPartialSection.agda: 1

1-260: LGTM!

docs/echo-types/MAP.adoc: 1

515-553: LGTM!

proofs/agda/EchoFibreIntersection.agda: 1

1-230: LGTM!

proofs/agda/All.agda: 1

53-58: LGTM!

proofs/agda/Smoke.agda: 1

614-622: LGTM!

Also applies to: 624-638, 640-661

CHANGELOG.adoc: 1

10-22: LGTM!

docs/bridges/cross-repo-bridge-status.adoc: 1

571-580: LGTM!

docs/echo-types/echo-kernel-note.adoc: 1

229-240: LGTM!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants